class MyQueue {
public:
    MyQueue() 
    {
    }
    
    void push(int x) 
    {
        while(!tmp2.empty())
        {
            tmp2.pop();
        }
        while(!tmp1.empty())
        {
            int num = tmp1.top();
            tmp1.pop();
            tmp2.push(num);
        }
        tmp2.push(x);
        while(!tmp2.empty())
        {
            int num=tmp2.top();
            tmp1.push(num);
            tmp2.pop();
        }
    }
    
    int pop() 
    {
        int num=tmp1.top();
        tmp1.pop();
        return num;
    }
    
    int peek() 
    {
        return tmp1.top();
    }
    
    bool empty() 
    {
        return tmp1.empty();
    }
private:
    stack<int> tmp1;
    stack<int> tmp2;
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */
